<template>
  <view>
    <!-- my-search  搜索组件 -->
    <view class="my-search-container" :style="{'background-color':bgColor}">
      <view class="my-search-box" :style="{'border-radius':radius + 'px'}" @click="searchBoxHandler">
        <uni-icons type="search" size="17"></uni-icons>
        <text class="placeholder">搜索</text>
      </view>
    </view>
  </view>
</template>

<script>
  export default {
    props:{
      //背景颜色
      bgColor:{
         type: String,
         default: '#C00000'
      },
      //圆角尺寸
      radius:{
        type: Number,
        //单位px
        default: 15
      }
    },
    name:"my-search",
    data() {
      return {
        
      };
    },
    methods:{
      searchBoxHandler(){
         // 触发外界通过 @click绑定的click事件 处理函数
          this.$emit('click')
      }
    },
    onLoad() {
      const sysInfo = uni.getSystemInfoSync()
       this.wh=sysInfo.windowHeight - 50
    }
  }
</script>

<style lang="scss">
.my-search-container{
    // background-color: #c00000;
    height: 50px;
    display: flex;
    align-items: center;
    padding: 0px 5px;
}
.my-search-box{
   height: 36px;
   background-color: #ffffff;
   display: flex;
   align-items: center;
   justify-content: center;
   width: 100%;
   // border-radius: 15px;
}
.placeholder{
  font-size: 15px;
   margin-left: 5px;
}
</style>